package com.springclouddemo.service.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("api/v1/consumer/rest")
public class ConsumerRestController {
    @Autowired
    private RestTemplate restTemplate;
//    @Inject
//    private RestTemplate restTemplate;

    @RequestMapping("hello")
    public String hello(String name) {
        String response = restTemplate.getForObject("http://localhost:9001/test/hello/" + name, String.class);
        return response;
    }
}
